﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using KPIS.GERP.Models.ICM;
using KPIS.GERP.Models.SYS;
using KPIS.GERP.WEB.GIMS.MasLookUpService;

namespace KPIS.GERP.WEB.GAMS.Classes
{
	public static class GimsLookupUtility
	{
		public static string GetLookupNameFromAllLookup(object lookupId)
		{
			using (var lus = new MasLookUpServiceClient())
			{
				var allLookup = lus.Select(new MasLookUp {RecordStatus = RecordStatus.UsedStatus});
				foreach (MasLookUp lu in allLookup)
				{
					if (Models.CompareUtility.IsObjectToStringEqual(lookupId, lu.LookUpId))
						return lu.LookUpName;
				}
				return string.Empty;
			}
		}
	}
}